<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <!--      <el-table-column label="ID" align="center" prop="id" />-->
      <el-table-column width="120px" label="微盟Id" align="center" prop="memberWid" />
      <el-table-column width="120px" label="会员手机号" align="center" prop="memberPhone" />
      <el-table-column width="120px" label="业绩" align="center" prop="profit" />
      <el-table-column width="120px" label="真实业绩" align="center" prop="realProfit" />
      <el-table-column width="120px" label="状态" align="center" prop="status">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.TEAM_SHARE_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
      <!--      <el-table-column label="订单编号" align="center" prop="orderNo" />-->
      <el-table-column width="120px" label="产品名" align="center" prop="goodsName" />
      <!--      <el-table-column label="skuId" align="center" prop="skuId" />-->
      <el-table-column width="120px" label="sku" align="center" prop="skuName" />
      <el-table-column label="数量" align="center" prop="quantity" />
      <el-table-column width="120px" label="买家WID" align="center" prop="buyerWid" />
      <el-table-column width="120px" label="买家级别" align="center" prop="buyerLevelName" />
      <el-table-column width="120px" label="会员手机号" align="center" prop="buyerPhone" />
      <el-table-column
        label="下单时间"
        align="center"
        prop="orderTime"
        :formatter="dateFormatter"
        width="180px"
      />
      <el-table-column
        label="确认时间"
        align="center"
        prop="confirmTime"
        :formatter="dateFormatter"
        width="180px"
      />

      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { OrderApi } from '@/api/wo/order'
import { DICT_TYPE } from '@/utils/dict'

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  orderId?: number // 产品ID（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await OrderApi.getTeamShareListByOrderId(props.orderId)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
